<template>
	<view class="page-body ">
		<web-view :src="html" :webview-styles="webviewStyles" v-if="hasHtml" @message="getwebviewMsg" ></web-view>
	</view>
</template>

<script>
	import {
	    mapState,
	    mapMutations
	} from 'vuex'	
	import {isPoneAvailable,trim,TimeStorage} from '@/utils/utils.js';
	import {host} from '@/utils/Config.js';
	var that;
	var wv;
	export default{
		data(){
			return{
				html:"",
				hasHtml:false,
				webviewStyles:{
					progress:{
						 color: '#FF3333'
					}
				}
			}
		},
		onLoad(options){
			that=this;
			let card = JSON.parse(decodeURIComponent(options.card));
			// #ifdef APP-PLUS
			plus.nativeUI.showWaiting();
			// #endif
			if(!card.linked_name){
				card.linked_name = "顶顶顶";
			}
			that.html = `${host}/unbindcard?utoken=${TimeStorage.geted('utoken')}&cardno=${card.linked_acctno}&cardname=${card.linked_name}&cid=${card.id}`
			that.hasHtml = true;
		},
		onReady() {
			// #ifdef APP-PLUS
			plus.nativeUI.closeWaiting();
			// #endif
			// #ifdef APP-PLUS
			var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象
			setTimeout(function() {
				wv = currentWebview.children()[0];
				// wv.setCssText('#backURL{display:none;}')
			}, 1000); //如果是页面初始化调用时，需要延时一下
			// #endif
		},
		onShow(options){
			this.changeRefresh(false)
		},
		computed:{
			
		},
		methods:{
			...mapMutations(['changeRefresh']),
			getwebviewMsg(e){
				this.changeRefresh(true)
			}
		},
		
		onUnload(){
		},
	}
	
</script>

<style lang="scss" scoped="">

</style>
